﻿using Abp.Domain.Entities.Auditing;
using Camc.Quality.Bop.TreeObject;
using Camc.Quality.Quality;
using System;
using System.Collections.Generic;

namespace Camc.Quality.Dto.TableReturnDto.Technique
{
    public class TechniqueReturnDto
    {

        /// <summary>
        /// 工艺ID
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// 布套节点ID
        /// </summary>
        public Guid BopNodeId { get; set; }

        /// <summary>
        /// 型号
        /// </summary>
        public string Model { get; set; }
        /// <summary>
        /// 发次
        /// </summary>
        public string LotNo { get; set; }
        /// <summary>
        /// 原PPSID
        /// </summary>
        public string OriginalPPSId { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string TechniqueName { get; set; }
        /// <summary>
        /// 工艺编号
        /// </summary>
        public string TechniqueNumber { get; set; }
        /// <summary>
        /// 作者
        /// </summary>
        public string TechniqueAuthor { get; set; }
        /// <summary>
        /// 编制时间
        /// </summary>
        public string TechniqueAuthorTime { get; set; }
        /// <summary>
        /// 校对人
        /// </summary>
        public string Proofreader { get; set; }
        /// <summary>
        /// 校对时间
        /// </summary>
        public string ProofreaderTime { get; set; }
        /// <summary>
        /// 审核人
        /// </summary>
        public string Reviewer { set; get; }
        /// <summary>
        /// 审核时间
        /// </summary>
        public string ReviewerTime { set; get; }
        /// <summary>
        /// 标检人
        /// </summary>
        public string Inspector { set; get; }
        /// <summary>
        /// 标检时间
        /// </summary>
        public string InspectorTime { set; get; }
        /// <summary>
        /// 批准人
        /// </summary>
        public string Certifier { set; get; }
        /// <summary>
        ///  批准时间
        /// </summary>
        public string CertifierTime { set; get; }
        /// <summary>
        /// 编写时间
        /// </summary>
        public DateTime? CompileTime { get; set; }
        /// <summary>
        /// 产品系统代号
        /// </summary>
        public string SystemCode { get; set; }
        /// <summary>
        /// 产品代号
        /// </summary>
        public string ProductCode { get; set; }
        /// <summary>
        /// 零、部、组件代号
        /// </summary>
        public string ModuleCode { get; set; }
        /// <summary>
        /// 零、部、组件名称
        /// </summary>
        public string ModuleName { get; set; }
        /// <summary>
        /// 阶段标记
        /// </summary>
        public StageSigns StageSign { get; set; }
        /// <summary>
        /// 工艺规程类型
        /// </summary>
        public TechniqueTypes TechniqueType { get; set; }
        /// <summary>
        /// 工艺规程特性
        /// </summary>
        public string TechniqueCharacter { get; set; }
        /// <summary>
        /// 纸质形式
        /// </summary>
        public Shapes Shape { get; set; }
        /// <summary>
        /// 文件密级
        /// </summary>
        public SecretDegrees SecretDegree { get; set; }
        /// <summary>
        /// 使用单位
        /// </summary>
        public string UseUnit { get; set; }
        /// <summary>
        /// 使用时间
        /// </summary>
        public string UseTime { get; set; }
        /// <summary>
        /// 依据文件
        /// </summary>
        public string BasisFile { get; set; }
        /// <summary>
        /// 分发单位
        /// </summary>
        public string IssueUnit { get; set; }
        /// <summary>
        /// 工艺说明
        /// </summary>
        public string TechniqueExplain { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 回传规程状态
        /// </summary>
        public string ReturnStatus { get; set; } = "";
        /// <summary>
        /// 规程状态
        /// </summary>
        public int Status { get; set; }

        public List<ProcessesReturnDto> ProcessesListDto { get; set; }
    }
    public class ReturnBopTaskOutDto
    {
        public Guid Id { get; set; }
        /// <summary>
        /// 1.型号
        /// </summary>
        public string Model { get; set; }
        /// <summary>
        /// 2.型号名称
        /// </summary>
        public string ModelName { get; set; }
        /// <summary>
        /// 3.发次
        /// </summary>
        public string LotNo { get; set; }
        /// <summary>
        /// 4.图号
        /// </summary>
        public string DrawingNo { get; set; }
        /// <summary>
        /// 5.阶段标识
        /// </summary>
        public string StageSign { get; set; }

        public TechniqueReturnDto TechniqueTask { get; set; }
        /// <summary>
        /// 回传的日志
        /// </summary>
        public List<EditFileProcess> _editFileList { get; set; }

        public List<FileProcessOperationDto> fileProcessOperationLogs { get; set; }
        public List<FileExceptionDto> FileException { get; set; }

        public List<FileWorkingHours> FileWorkingHours { get; set; }

        public List<RosterPlan> RosterPlans { get; set; }

        public List<ClearSignatureRecord> ClearSignatureRecord { get; set; }

    }
    //计划排配接收类
    public class RosterPlan : FullAuditedEntity<Guid>
    {

        public Guid NodeId { get; set; }
        //public Guid NodeId { get; set; }

        public DateTime? StartTime { get; set; }

        public DateTime? EndTime { get; set; }

        public decimal WorkHour { get; set; }

        /// <summary>
        /// 装配班组
        /// </summary>
        public string OrganizationUnitId { get; set; }
        /// <summary>
        /// 装配班组描述
        /// </summary>
        public string OrganizationUnitDesc { get; set; }
        /// <summary>
        /// 状态
        /// </summary>
        public int ProductingStatus { get; set; }

        /// <summary>
        ///装配人员
        /// </summary>
        public string UserId { get; set; }

        public Guid? ProcessId { get; set; }

        public Guid? StepId { get; set; }

        public Guid? FileId { get; set; }
        public string CreatorUserName { get; set; }
    }


    public class FileWorkingHours : FullAuditedEntity<long>
    {
        public Guid FileId { get; set; }

        public Guid? ProcessId { get; set; }

        public Guid? StepId { get; set; }
        public string CreatorUserName { get; set; }
        public List<FileWorkingHoursUserRecord> FileWorkingHoursUserRecords { get; set; } = new List<FileWorkingHoursUserRecord>();
    }

    public class FileWorkingHoursUserRecord : FullAuditedEntity<long>
    {
        public FileWorkingHours FileWorkingHours { get; set; }
        public long FileWorkingHoursId { get; set; }

        public long UserId { get; set; }

        public decimal Hours { get; set; }
        public string CreatorUserName { get; set; }

    }


    public class FileExceptionDto
    {
        //异常分类
        public int ExecptionType { get; set; }
        //异常等级 0：一般 1：严重 2：非常严重
        public int Level { get; set; }
        //异常单号
        public string Number { get; set; }
        //异常描述
        public string Description { get; set; }
        //规程文件ID
        public string FileId { get; set; }
        //状态 0：未处理 1：处理中 2：已驳回 3：处理完成
        public int Status { get; set; }
        //多媒体文件名
        public string MediaFiles { get; set; }
        //工序ID
        public Guid? ProcessId { get; set; }
        //工步ID
        public Guid? StepId { get; set; }
        public DateTime CreationTime { get; set; }
        public int? CreatorUserId { get; set; }
        public string CreatorUserName { get; set; }
        public string LastModificationUserName { get; set; }
        public DateTime? LastModificationTime { get; set; }
        public List<FileExceptionProcessingRecordDto> FileExceptionProcessingRecords { get; set; }
    }
    public class ReturnTechniques
    {
        public List<ReturnBopTaskOutDto> techniques { get; set; } = new List<ReturnBopTaskOutDto>();

        public BopTreeJson bopTree { get; set; }
    }
    public class FileExceptionProcessingRecordDto
    {
        //异常实体
        public string FileException { get; set; }
        //异常id
        public int FileExceptionId { get; set; }
        //处理意见
        public string Remark { get; set; }
        //状态 0：未处理 1：处理中 2：已驳回 3：处理完成
        public int Status { get; set; }
        public DateTime CreationTime { get; set; }
        public int? CreatorUserId { get; set; }
        public string CreatorUserName { get; set; }
    }
}
